public class Test3 {
    public static void main(String[] args) {
                // 表头部分，固定数据直接输出
                System.out.println("----------------------商场库存清单----------------------");
                System.out.println("品牌型号\t\t尺寸\t\t价格\t\t库存数");

                // 定义变量描述商品信息，注意数据类型
                String model1 = "MacBookAir";
                double size1 = 13.3;
                double price1 = 5699.0;
                int stock1 = 5;

                String model2 = "ThinkPadT490";
                double size2 = 14.0;
                double price2 = 8499.0;
                int stock2 = 10;

                String model3 = "MateBook 14";
                double size3 = 14.0;
                double price3 = 7199.0;
                int stock3 = 18;

                // 表格中间内容，按格式输出，\t 用于对齐
                System.out.printf("%s\t%.1f\t%.1f\t%d\n", model1, size1, price1, stock1);
                System.out.printf("%s%.1f\t%.1f\t%d\n", model2, size2, price2, stock2);
                System.out.printf("%s\t%.1f\t%.1f\t%d\n", model3, size3, price3, stock3);

                // 表格尾部，先进行数学计算
                int totalStock = stock1 + stock2 + stock3;
                double totalAmount = price1 * stock1 + price2 * stock2 + price3 * stock3;

                // 输出表尾计算结果
                System.out.println("------------------------------------------------------");
                System.out.println("总库存数：" + totalStock);
                System.out.println("商品库存总金额：" + totalAmount);
    }
}
